package com.lmx.repoDomain.tmodel;


import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import com.lmx.repoDomain.tmodel.business.User;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiLookupIncludeAutomatically;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;


/**
 * 服务变更表
 */
@JsonApiResource(type = "customerserverchange")
@Table(name = "tnb_customer_server_change")
@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class CustomerServerChange extends BaseEntity {

	private String remark;// 备注

	private User lastUpdateUser;// 更新操作者userid

	private Integer createDateTime;// 创建时间

	private User createUser;

	private Integer lastUpdateDateTime;// 更新时间
	
	private Double totalPriceOld;

	private Double totalPriceNew;//月费

	private Double priceOld;

	private Double priceNew;//日费

	private Bed bedOld;

	private Bed bedNew;
	
	private Double bedOldReferencePrice;//变更前参考价格
	
	private Double bedPriceOld;

	private Double bedNewReferencePrice;//变更前后参考价格
	
	private Double bedPriceNew;
	
	private Dicttype type;

	private Dicttype status;

	private DicttypeTenant foodLevelOld;

	private DicttypeTenant foodLevelNew;
	
	private Double foodLevelOldReferencePrice;//变更前参考价格
	
	private Double foodPriceOld;
	
	private Double foodLevelNewReferencePrice;//变更hou参考价格
	
	private Double foodPriceNew;
	
	private NursingLevel nursingLevelOld;
	
	private Double nursingLevelOldReferencePrice;//变更前参考价格
	
	private Double nursingLevelNewReferencePrice;//变更hou参考价格
	
	private NursingLevel nursingLevelNew;

	private Integer effectiveTime;// 生效时间

	private Integer contractEndDateOld;// 变更前合同截止时间
	
	private Integer contractEndDateNew;// 变更后合同截止时间
	
	private Customer customer;
	
	private Dicttype customerStatus;
	
	private Dicttype chargeType;
	
	private Dicttype customerStatusOld;
	
	private Dicttype chargeTypeOld;

	private Double projectPriceOld;
	
	private Double projectPriceNew;
	
	private CustomerBusinessFlow flow;
	
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "customerstatus_old_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getCustomerStatusOld() {
		return customerStatusOld;
	}

	public void setCustomerStatusOld(Dicttype customerStatusOld) {
		this.customerStatusOld = customerStatusOld;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "chargetype_old_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getChargeTypeOld() {
		return chargeTypeOld;
	}

	public void setChargeTypeOld(Dicttype chargeTypeOld) {
		this.chargeTypeOld = chargeTypeOld;
	}

	@Column(name = "bed_old_referenceprice")
	public Double getBedOldReferencePrice() {
		return bedOldReferencePrice;
	}

	public void setBedOldReferencePrice(Double bedOldReferencePrice) {
		this.bedOldReferencePrice = bedOldReferencePrice;
	}

	@Column(name = "bed_new_referenceprice")
	public Double getBedNewReferencePrice() {
		return bedNewReferencePrice;
	}

	public void setBedNewReferencePrice(Double bedNewReferencePrice) {
		this.bedNewReferencePrice = bedNewReferencePrice;
	}

	@Column(name = "food_old_referenceprice")
	public Double getFoodLevelOldReferencePrice() {
		return foodLevelOldReferencePrice;
	}

	public void setFoodLevelOldReferencePrice(Double foodLevelOldReferencePrice) {
		this.foodLevelOldReferencePrice = foodLevelOldReferencePrice;
	}

	@Column(name = "food_new_referenceprice")
	public Double getFoodLevelNewReferencePrice() {
		return foodLevelNewReferencePrice;
	}

	public void setFoodLevelNewReferencePrice(Double foodLevelNewReferencePrice) {
		this.foodLevelNewReferencePrice = foodLevelNewReferencePrice;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "nursinglevel_old_id", foreignKey = @ForeignKey(name = "null"))
	public NursingLevel getNursingLevelOld() {
		return nursingLevelOld;
	}

	public void setNursingLevelOld(NursingLevel nursingLevelOld) {
		this.nursingLevelOld = nursingLevelOld;
	}

	@Column(name = "nursinglevel_old_referenceprice")
	public Double getNursingLevelOldReferencePrice() {
		return nursingLevelOldReferencePrice;
	}

	public void setNursingLevelOldReferencePrice(Double nursingLevelOldReferencePrice) {
		this.nursingLevelOldReferencePrice = nursingLevelOldReferencePrice;
	}

	@Column(name = "nursinglevel_new_referenceprice")
	public Double getNursingLevelNewReferencePrice() {
		return nursingLevelNewReferencePrice;
	}

	public void setNursingLevelNewReferencePrice(Double nursingLevelNewReferencePrice) {
		this.nursingLevelNewReferencePrice = nursingLevelNewReferencePrice;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "nursinglevel_new_id", foreignKey = @ForeignKey(name = "null"))
	public NursingLevel getNursingLevelNew() {
		return nursingLevelNew;
	}

	public void setNursingLevelNew(NursingLevel nursingLevelNew) {
		this.nursingLevelNew = nursingLevelNew;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "customerstatus_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getCustomerStatus() {
		return customerStatus;
	}

	public void setCustomerStatus(Dicttype customerStatus) {
		this.customerStatus = customerStatus;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "chargetype_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getChargeType() {
		return chargeType;
	}

	public void setChargeType(Dicttype chargeType) {
		this.chargeType = chargeType;
	}

	@JsonApiToOne
	@JsonApiLookupIncludeAutomatically(overwrite = true)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "flow_id", foreignKey = @ForeignKey(name = "null"))
	public CustomerBusinessFlow getFlow() {
		return flow;
	}

	public void setFlow(CustomerBusinessFlow flow) {
		this.flow = flow;
	}

	@Column(name = "total_price_old")
	public Double getTotalPriceOld() {
		return totalPriceOld;
	}

	public void setTotalPriceOld(Double totalPriceOld) {
		this.totalPriceOld = totalPriceOld;
	}

	@Column(name = "total_price_new")
	public Double getTotalPriceNew() {
		return totalPriceNew;
	}

	public void setTotalPriceNew(Double totalPriceNew) {
		this.totalPriceNew = totalPriceNew;
	}
	
	@Column(name = "project_price_old")
	public Double getProjectPriceOld() {
		return projectPriceOld;
	}

	public void setProjectPriceOld(Double projectPriceOld) {
		this.projectPriceOld = projectPriceOld;
	}

	@Column(name = "project_price_new")
	public Double getProjectPriceNew() {
		return projectPriceNew;
	}

	public void setProjectPriceNew(Double projectPriceNew) {
		this.projectPriceNew = projectPriceNew;
	}

	@Column(name = "bed_price_old")
	public Double getBedPriceOld() {
		return bedPriceOld;
	}

	public void setBedPriceOld(Double bedPriceOld) {
		this.bedPriceOld = bedPriceOld;
	}

	@Column(name = "bed_price_new")
	public Double getBedPriceNew() {
		return bedPriceNew;
	}

	public void setBedPriceNew(Double bedPriceNew) {
		this.bedPriceNew = bedPriceNew;
	}

	@Column(name = "food_price_old")
	public Double getFoodPriceOld() {
		return foodPriceOld;
	}

	public void setFoodPriceOld(Double foodPriceOld) {
		this.foodPriceOld = foodPriceOld;
	}

	@Column(name = "food_price_new")
	public Double getFoodPriceNew() {
		return foodPriceNew;
	}

	public void setFoodPriceNew(Double foodPriceNew) {
		this.foodPriceNew = foodPriceNew;
	}

	@Column(name = "effective_time")
	public Integer getEffectiveTime() {
		return effectiveTime;
	}

	public void setEffectiveTime(Integer effectiveTime) {
		this.effectiveTime = effectiveTime;
	}

	@Column(name = "price_old")
	public Double getPriceOld() {
		return priceOld;
	}

	public void setPriceOld(Double priceOld) {
		this.priceOld = priceOld;
	}

	@Column(name = "price_new")
	public Double getPriceNew() {
		return priceNew;
	}

	public void setPriceNew(Double priceNew) {
		this.priceNew = priceNew;
	}

	@JsonApiToOne
	@JsonApiLookupIncludeAutomatically(overwrite = true)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "bed_old", foreignKey = @ForeignKey(name = "null"))
	public Bed getBedOld() {
		return bedOld;
	}

	public void setBedOld(Bed bedOld) {
		this.bedOld = bedOld;
	}

	@JsonApiToOne
	@JsonApiLookupIncludeAutomatically(overwrite = true)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "bed_new", foreignKey = @ForeignKey(name = "null"))
	public Bed getBedNew() {
		return bedNew;
	}

	public void setBedNew(Bed bedNew) {
		this.bedNew = bedNew;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "type_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getType() {
		return type;
	}

	public void setType(Dicttype type) {
		this.type = type;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "status_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getStatus() {
		return status;
	}

	public void setStatus(Dicttype status) {
		this.status = status;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "foodLevel_old", foreignKey = @ForeignKey(name = "null"))
	public DicttypeTenant getFoodLevelOld() {
		return foodLevelOld;
	}

	public void setFoodLevelOld(DicttypeTenant foodLevelOld) {
		this.foodLevelOld = foodLevelOld;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "foodLevel_new", foreignKey = @ForeignKey(name = "null"))
	public DicttypeTenant getFoodLevelNew() {
		return foodLevelNew;
	}

	public void setFoodLevelNew(DicttypeTenant foodLevelNew) {
		this.foodLevelNew = foodLevelNew;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "customer_id", foreignKey = @ForeignKey(name = "null"))
//	
//	@JsonApiToOne
//	@JsonApiLookupIncludeAutomatically(overwrite = true)
//	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
//	@Fetch(FetchMode.JOIN)
//	@JoinColumn(name = "bed_new", foreignKey = @ForeignKey(name = "null"))
//	
//	
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	@Column(name = "lastUpdateDateTime")
	public Integer getLastUpdateDateTime() {
		return lastUpdateDateTime;
	}

	public void setLastUpdateDateTime(Integer lastUpdateDateTime) {
		this.lastUpdateDateTime = lastUpdateDateTime;
	}

	@Column(name = "createDateTime")
	public Integer getCreateDateTime() {
		return createDateTime;
	}

	public void setCreateDateTime(Integer createDateTime) {
		this.createDateTime = createDateTime;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "createuser_id", foreignKey = @ForeignKey(name = "null"))
	public User getCreateUser() {
		return createUser;
	}

	public void setCreateUser(User createUser) {
		this.createUser = createUser;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "lastupdateuser_id", foreignKey = @ForeignKey(name = "null"))
	public User getLastUpdateUser() {
		return lastUpdateUser;
	}

	public void setLastUpdateUser(User lastUpdateUser) {
		this.lastUpdateUser = lastUpdateUser;
	}

	public CustomerServerChange() {
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "contract_enddate_old")
	public Integer getContractEndDateOld() {
		return contractEndDateOld;
	}

	public void setContractEndDateOld(Integer contractEndDateOld) {
		this.contractEndDateOld = contractEndDateOld;
	}

	@Column(name = "contract_enddate_new")
	public Integer getContractEndDateNew() {
		return contractEndDateNew;
	}

	public void setContractEndDateNew(Integer contractEndDateNew) {
		this.contractEndDateNew = contractEndDateNew;
	}

}
